package com.sa.token.handler;


import com.sa.token.entity.SysOperationLogEntity;
import com.sa.token.mapper.SysOperationLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @desc: 记录系统操作日志
 * @projectName： sa-token-serve
 * @author： xhs
 * @date： 2021/12/30 14:00
 * @version: JDK 1.8
 */
@Slf4j
@Component
public class SystemLog {
    @Resource
    private SysOperationLogMapper operationLogMapper;

    /**
     * @param request
     * @param operationLog 系统模块
     */
    @Async("taskExecutor")
    public void systemLog(HttpServletRequest request, SysOperationLogEntity operationLog) {
        log.info(">>>>>>>>>>>>>>记录系统操作日志<<<<<<<<<<<<<<<<<<<<");
        operationLogMapper.insert(operationLog);
    }
}
